/*
 * @Author: sunzhijun 
 * @Date: 2019-07-30 14:55:12 
 * @Last Modified by: sunzhijun
 * @Last Modified time: 2019-12-12 20:09:32
 */
import {hrAjax, formatDate, getAppPageConfig} from 'src/hrpub/common/utils/utils';
// const appConfig = getAppPageConfig();
// debugger
export default {
    name: 'main',
    data: {
        language: {},                       // 多语
        context: {},
        // appConfig: {
        //     pagecode: appConfig.pagecode,
        //     appcode: appConfig.appcode
        // },
        isEdit: false,                      //是否编辑状态
        selectedData: '',                   //选择的数据
        pageInfo: {                         //分页默认数据
            pageSize: 10,
            total: 10,
            pageIndex: 1
        },
        isChecked: false,                   //子集选择框选中状态
        tableId: 'poi_list',                //table区域ID
        cardId: 'bd_psndoc',                //主卡片区域ID
        treeId: 'treeid',                   //左树id
        isVisiblePagination: false,         //是否显示翻页
        treeData : '',                      //左树数据
        formLists: ['bd_psndoc','hi_psnorg_h','hi_psnjob_h'], //默认form数据
        areaCodeList: [],                   //需要显示的区域code id
        busiSet: [],                        //可操作table
        isDisabled: true,                   //是否显示子集是否禁用态
        ui_state: 1,                        //页面状态，1:新增 2:修改
        oid: '',                            
        isCardForm: false,                  //是否是卡片页面  默认false 列表页
        tree_node_id: null,                 //左树默认选择的树ID
        orgValue: '',                       //组织信息
        conHeight: '100%',                  //默认内容区域高度
        footerHeight: 'auto',               //底部默认高度
        isShowSub: false,                   //设置是否隐藏子集
        isModalVisible: false,              //是否显示人员唯一性信息弹窗
        subTableEditable: true,             //是否显示子表操作按你
        clickNum: 0 ,                       //子表要删除的行索引
        pk_psncl:  '',                      //人员主键
        bd_psndoc: {},
        hi_psndoc_cert: {},
        hi_psnjob_h: {},                    //默认工作信息数据
        hi_psnorg_h: {},                    //默认组织关系数据
        InJobType: 'hire',                  //默认入职类型
        batchEditModalVisible: false,       //批量修改弹窗显隐性
        terminationModalVisible: false,     //终止关系设置显隐性
        dieModalVisible: false,             //身故处理设置显隐性
        selectedRows: '',                   //批量选择的数据
        defaultTime: formatDate(new Date()), //设置默认时间
        time: '',    //选择后的时间
        defaultRowData: [],                 //终止关系和身故处理默认数据
        queryOneData: '',                   // 存储queryOne接口返回的数据，终止关系需要用到
        activeKey: '3',                     //子集设置当前激活的tabPanel的key
        pk_psnjob: '',                      //人员主键
        sortModalVisible: false,            //排序显隐性
        showUploader: false,                //附件管理显隐性
        isSort: false,                      //是否需要排序
        batchAddSubVisible: false,          //批量添加子集
        printData: {},                       //打印输出要传输给后台的数据
        isDisableUpload: true,              //禁止上传头像
        isNewAdd: false,                     //保存新增默认false
        subTables: [],
        flag: false
    },
    sync: {
        update(state, payload) {
            return {
                ...state,
                ...payload
            };
        }
    },
    async: {
        // 获取相关人员信息
        getPersonnelData(dispatch, getState, payload){
            return hrAjax({
                url: '/nccloud/hrhi/poi/PoiPsnQueryAction.do',
                body: payload
            })
        },
        // 左树人员类别
        getTreeData(dispatch, getState, payload){
            return hrAjax({
                url: '/nccloud/hrhi/psndoc/PsndocTreePsnclAction.do',
                body: payload
            })
        },
        //新增人员唯一性信息
        getUniqueTemp(dispatch, getState, payload){
            return hrAjax({
                url: '/nccloud/hrhi/poi/PoiPsnAddInitDlgAction.do',
                body: payload
            })
        },
        //新增人员唯一性校验1
        isCheckUniqueOne(dispatch, getState, payload){
            return hrAjax({
                url: '/nccloud/hrhi/poi/PoiPsnAddDlgOk1Action.do',
                body: payload
            })
        },
        //新增人员唯一性校验2
        isCheckUniqueTwo(dispatch, getState, payload){
            return hrAjax({
                url: '/nccloud/hrhi/poi/PoiPsnAddDlgOk2Action.do',
                body: payload
            })
        },
        // 保存时校验
        saveCheckData(dispatch, getState, payload){
            return hrAjax({
                url: '/nccloud/hrhi/poi/PoiPsnSaveCheckAction.do',
                body: payload
            })
        },
        // 保存
        saveData(dispatch, getState, payload){
            return hrAjax({
                url: '/nccloud/hrhi/poi/PoiPsnSaveDoAction.do',
                body: payload
            })
        },
        //浏览卡片
        queryOneAction(dispatch, getState, payload){
            return hrAjax({
                url: '/nccloud/hrhi/psndoc/PsndocQueryOneAction.do',
                body: payload
            })
        },
        //删除相关人员信息
        deletePersonnelInfo(dispatch, getState, payload){
            return hrAjax({
                url: '/nccloud/hrhi/psndoc/PsndocDeleteAction.do',
                body: payload
            })
        },
        //相关人员修改前校验
        editPersonnelInfo(dispatch, getState, payload){
            return hrAjax({
                url: '/nccloud/hrhi/psndoc/PsndocEditAction.do',
                body: payload
            })
        },
        //保存成功后调用数据
        getSaveData(dispatch, getState, payload){
            return hrAjax({
                url: '/nccloud/hrhi/psndoc/PsndocQueryOneNoTempAction.do',
                body: payload
            })
        },
        //查询子集数据
        getSubData(dispatch, getState, payload){
            return hrAjax({
                url: '/nccloud/hrhi/psndoc/PsndocLoadSubDataAction.do',
                body: payload
            })
        },
        //终止关系
        setTermination(dispatch, getState, payload){
            return hrAjax({
                url: '/nccloud/hrhi/poi/PoiPsnStopRelationAction.do',
                body: payload
            })
        },
        //身故处理校验
        dieCheckAction(dispatch, getState, payload){
            return hrAjax({
                url: '/nccloud/hrtrn/dimissionrds/DimissionRdsDieCheckAction.do',
                body: payload
            })
        },
        //身故处理
        dieAction(dispatch, getState, payload){
            return hrAjax({
                url: '/nccloud/hrtrn/dimissionrds/DimissionRdsDieDoAction.do',
                body: payload
            })
        },
        //导出照片
        exportPhoto(dispatch, getState, payload){
            return hrAjax({
                url: '/nccloud/hrhi/psndoc/PsndocExportPhotoAction.do',
                body: payload
            })
        },
        //保存调整顺序
        saveAdjustSortAction(dispatch, getState, payload){
            return hrAjax({
                url: '/nccloud/hrhi/psndoc/PsndocAdjustSortAction.do',
                body: payload
            })
        },
        //判断是否需要批量增加子集
        judgeAddSubAction(dispatch, getState, payload){
            return hrAjax({
                url: '/nccloud/hrhi/poi/PoiPsnBatchAddAction.do',
                body: payload
            })
        },
        //Form区域编辑前调用
        formBeforeAction(dispatch, getState, payload){
            return hrAjax({
                url: '/nccloud/hrhi/psndoc/PsndocHeadBeforeEditAction.do',
                body: payload
            })
        },
        //Form区域编辑后调用
        formAfterAction(dispatch, getState, payload){
            return hrAjax({
                url: '/nccloud/hrhi/psndoc/PsndocHeadAfterEditAction.do',
                body: payload
            })
        },
        //子集表体编辑前调用
        subTableBeforeAction(dispatch, getState, payload){
            return hrAjax({
                url: '/nccloud/hrhi/psndoc/PsndocBodyBeforeEditAction.do',
                body: payload
            })
        },
        //子集表体编辑后调用
        subTableAfterAction(dispatch, getState, payload){
            return hrAjax({
                url: '/nccloud/hrhi/psndoc/PsndocBodyAfterEditAction.do',
                body: payload
            })
        },
        //行操作新增
        subAddAction(dispatch, getState, payload){
            return hrAjax({
                url: '/nccloud/hrhi/psndoc/PsndocSubAddAction.do',
                body: payload
            })
        }
    }
};